package com.cardgame.model.role;

import lombok.Getter;
import lombok.Setter;
import org.springframework.stereotype.Component;

import java.util.Map;

@Setter
@Getter
@Component
public class Role implements IRole {
    private int id;
    private String name;
    private String imageUrl;
    private String introduction;
    private int hp;
    private int mp;
    private Skill skill;
    private int price;

    public Role() {
    }

    public Role(int id, String name, String imageUrl, String introduction, int hp, int mp, Skill skill, int price) {
        this.id = id;
        this.name = name;
        this.imageUrl = imageUrl;
        this.introduction = introduction;
        this.hp = hp;
        this.mp = mp;
        this.skill = skill;
        this.price = price;
    }

    @Override
    public Skill getSkill() {
        return skill;
    }

    @Override
    public int getPrice() {
        return price;
    }

    public Map<String, Object> toMap() {
        return Map.of(
                "id", id,
                "name", name,
                "imageUrl", imageUrl,
                "introduction", introduction,
                "rawHp", hp,
                "rawMp", mp,
                "skill", skill.toMap(),
                "price", price
        );
    }
}